<template>
  <transition name="fade" mode="out-in">
    <div class="zh-main">
      <el-container>
        <el-header>
          <zh-header />
        </el-header>
        <transition name="fade" mode="out-in">
          <router-view />
        </transition>
        <el-footer>{{ copyrightInfo }}</el-footer>
      </el-container>
    </div>
  </transition>
</template>
<script>
export default {
  created() {
    if (!sessionStorage.getItem("CopyrightInfo")) {
      this.getCopyrightInfo();
    } else {
      this.$store.commit(
        "SET_COPYRIGHTiNFO",
        sessionStorage.getItem("CopyrightInfo")
      );
    }
  },
  computed: {
    copyrightInfo() {
      return deep_clone(this.$store.getters.copyrightInfo);
    },
  },
  methods: {
    /**
     * 获取版权信息
     * @modify 2019-5-10
     */
    getCopyrightInfo() {
      let success = (res) => {
        if (!is_empty(res.data.info.info_copyright)) {
          sessionStorage.setItem("CopyrightInfo", res.data.info.info_copyright);
          this.$store.commit("SET_COPYRIGHTiNFO", res.data.info.info_copyright);
        }
      };

      this.$ajax.get("api/setting/page_foot", { func: { success: success } });
    },
  },
};
</script>
